package com.wimcorp.magic.abilities;

import com.wimcorp.magic.exception.CastException;
import com.wimcorp.magic.players.Player;

public class UndoAbility extends Ability {

	private Ability ability;

	public UndoAbility(Ability ability) {
		this.ability = ability;
	}

	public void cast() {
		ability.uncast();
		switch (ability.getDuration()) {
		case END_OF_TURN:
			getPlayer().getEndingPhase().unRegisterEndOfTurnObserver(this);
			break;
		}
	}

	@Override
	public Ability clone() {
		return null;
	}

	@Override
	protected void executeAbility() throws CastException {

	}

	public Player getPlayer() {
		return ability.getPlayer();
	}

}
